送信

Postgresql Analytics Mcp Server

@Archimedes Market

The MCP PostgreSQL Analytics server provides advanced analytics capabilities for PostgreSQL databases, including smart schema exploration, query optimization, index suggestions, and natural language to SQL conversion. It is designed to enhance database performance and accessibility through AI-driven tools.
概要

PostgreSQL Analytics MCP Server

PostgreSQL Analytics for AI Assistants

Go beyond basic SQL. This MCP server gives your AI assistant deep visibility into PostgreSQL databases: smart schema
exploration, query plan analysis with bottleneck annotations, index optimization suggestions, table health monitoring, referential integrity auditing, and natural language to SQL generation.

Tools

  • explore_schema — Structured schema tree: tables, columns, types, FKs, indexes, row counts, sizes
  • analyze_query — EXPLAIN ANALYZE with human-readable bottleneck annotations (seq scans, disk spills, estimate mismatches)
  • suggest_indexes — Analyze slow queries or entire databases, suggest optimal indexes with CREATE INDEX statements
  • table_stats — Row counts, dead tuples, bloat %, vacuum/analyze history, cache hit ratios
  • find_missing_fks — Detect *_id columns without FK constraints, auto-generate ALTER TABLE suggestions
  • generate_query — Natural language to SQL using actual schema context, with optional execution

Installation

{
  "mcpServers": {
    "postgres": {
      "command": "node",
      "args": ["/path/to/mcp-postgres-analytics/dist/index.js"],                                                           
      "env": {
        "DATABASE_URL": "postgres://user:password@localhost:5432/mydb"                                                     
      }                                                                                                                    
    }
  }                                                                                                                        
}                                                         

Use cases

- Understand a new database in one prompt — full schema with row counts and FK relationships                               
- Optimize slow queries with annotated EXPLAIN ANALYZE output
- Find missing foreign keys across an entire schema in seconds                                                             
                                                                                                                           
License
                                                                                                                           
MIT — full source on archimedes.market                                                                                     
 
---                                                                                                                        
             

サーバー設定

{
  "mcpServers": {
    "postgres": {
      "command": "node",
      "args": [
        "/path/to/mcp-postgres-analytics/dist/index.js"
      ],
      "env": {
        "DATABASE_URL": "postgres://user:password@localhost:5432/mydb"
      }
    }
  }
}
- MCP Server